package JZ12_数值的整数次方;

public class Solution {
    public double Power(double base, int exponent) {
        double result = 1;
        if (exponent == 0){
            return 1;
        }
        if (exponent > 0){
            for (int i = 0; i < exponent; i++){
                result *= base;
            }
            return result;
        }else {
            for (int i = 0; i < -exponent; i++){
                result *= base;
            }
            return 1 / result;
        }
    }
}
